/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import Model.Bookticket;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

/**
 *
 * @author Sony
 */
@ManagedBean(name="Booktickets")
@RequestScoped
public class BookticketController {
    BookticketHelper helper;
    private Bookticket newBookticket;
    DataModel lstBookticket;
    public BookticketController(){
        helper = new BookticketHelper();
        newBookticket = new Bookticket();
    }
    
    public DataModel listBooktickets(){
        lstBookticket = new ListDataModel(this.helper.getAllBookticket());
        return lstBookticket;
    }
    
    public void addBooktickets(){
        this.helper.updateBookticket(newBookticket);
    }
    
    public void editBookticket(Bookticket b){
        this.helper.updateBookticket(b);
    }
    
    public void deleteBookticket(Bookticket b){
        this.helper.deleteBookticket(b);
    }

    /**
     * @return the newBookticket
     */
    public Bookticket getNewBookticket() {
        return newBookticket;
    }

    /**
     * @param newBookticket the newBookticket to set
     */
    public void setNewBookticket(Bookticket newBookticket) {
        this.newBookticket = newBookticket;
    }
    
    
}
